<!DOCTYPE html>
<html>

<head>
    <title>重置密码</title>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0,maximum-scale=1,user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="telephone=no" name="format-detection">
    <link rel="stylesheet" type="text/css" href="/resource/web/css/reset.css">
    <link rel="stylesheet" type="text/css" href="/resource/web/css/forget-pwd.css">
    <script type="text/javascript" src="/resource/web/js/flexible.js"></script>
    <script type="text/javascript" src="/resource/web/js/jquery-1.11.1.min.js"></script>
</head>

<body>
    <div class="title">
        <p>重置密码</p>
        <a href="javascript:;" onClick="javascript :history.back(-1);"><img class="back" src="/resource/web/img/newhead/path_7_copy.png"></a>
    </div>
    <div class="pwd-log">
        <p class="pl-img"><img src="/resource/web/img/finacing/setpwd.png"></p>
        <p class="pl-tit">重置密码</p>
    </div>
    <div class="pwd-list">
        <p><input type="password" name="pwd" id="newpwd" placeholder="6-16个字符，由字母+数字和符号两种以上组合"></p>
        <p>
            <input type="password" name="surepwd" id="surepwd"  placeholder="确认密码">
        </p>
        <input type="hidden" id="phone" name="phone" value="{{$mobile}}">
    </div>
    <div class="go-next-btn" onclick="ForgetSetPwd()">确定</div>
<script type="text/javascript">
function ForgetSetPwd(){
    var newpwd      =$('#newpwd').val();
    var surepwd     =$('#surepwd').val();
    var phone       =$('#phone').val();
    var reg_pwd= /(?!^[0-9]+$)(?!^[A-z]+$)(?!^[^A-z0-9]+$)^.{6,16}$/;
    if(!reg_pwd.test(newpwd)){
       alert( "6-16个字符，由字母+数字和符号两种以上组合");
        return false;
    }
    if(!reg_pwd.test(surepwd)){
        alert( "6-16个字符，由字母+数字和符号两种以上组合");
        return false;
    }
    if(surepwd!=newpwd){
        alert( "两次密码不一致");
        return false;
    }
    $.ajax({
        url : 'web_forgetset.html',
        type : "post",
        data : {newpwd:newpwd,surepwd:surepwd,phone:phone},
        dataType : "json",
        timeout:30000,
        success: function (json) {
            if (json.code == 1) {//ok
                alert(json.mess);
                window.location.href ="/Web/web_useraccount.html";
            }
            if (json.code == 2) {//ok
                alert(json.mess);
               // window.location.href =json.url;

            }
        }
    });


}
</script>
</body>

</html>
